package creation_patterns.singleton_pattern.threadlocal;

public class ThreadLocalSingleton {
    private ThreadLocalSingleton(){}
    private final static ThreadLocal<ThreadLocalSingleton> threadlocalMap = new ThreadLocal<ThreadLocalSingleton>(){
        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    public static ThreadLocalSingleton getInstance(){
        return threadlocalMap.get();
    }
}
